from PIL import Image
from PIL import ImageDraw

img = Image.new(mode='RGB', size=(100, 100), color=(20, 255, 255))
draw = ImageDraw.Draw(img, mode='RGBA')
draw.text((10, 10), text='python', fill='red')

with open('code.png', 'wb') as f:
    img.save(f, format='PNG')